#pragma once

class Board;

class ICEngine {
private:
	ICEngine() {}

	static int dead_cell_1[729];

	static int inferior_1[729];
	static std::vector<int> inferior_key_1[729];

	static int captured_2[6561];

	static int inferior_2[6561];
	static std::vector<int> inferior_key_2[6561];


	static int dir1[6][2];
	static int dir21[8][2];
	static int dir22[8][2];
	static int dir23[8][2];

public:
	static void load_one_dead_1(const std::string & pattern);
	static void load_one_inferior_1(const std::string & pattern);
	static void load_one_captured_2(const std::string & pattern);
	static void load_one_inferior_2(const std::string & pattern);
	static void load_from_dir(const std::string & dir);

	static bool is_dead_1(Board & board, int x, int y);
	static bool calc_dead_1(Board & board, int out[200], bool alter);

	static bool is_inferior_1(Board & board, int x, int y, int player, std::vector<int> & key);
	static void calc_inferior_1(Board & board, int out[200], int player);

	static bool is_captured_2(Board & board, int x, int y, int dir, int player);
	static bool calc_captured_2(Board & board, int out[200], int player, bool alter);

	static bool is_inferior_2(Board & board, int x, int y, int dir, int player, std::vector<int> & key);
	//static void calc_inferior_2(Board & board, int out[200], int player);

	static void calc_inferior_edge(Board & board, int out[200], int player);

	static void calc_inferior(Board & board, int out[200], int player);


	static void solve(const Board & board, int out[200], int player);

	static void solve_captured_and_dead(const Board & board, int out[200]);

	static void solve_inferior(const Board & board, int out[200], int player);
};